<template>
  <ul class="todo-main">
    <transition-group name="todo" appear>
      <MyItem v-for="todoObj in todos" :key="todoObj.id" :todo="todoObj" />
    </transition-group>
    
  </ul>
</template>

<script>
  import MyItem from "./MyItem"

  export default {
    name: "MyList",
    components: {
      MyItem
    },
    props:['todos']
  }
</script>

<style>
  .todo-main {
    border: 1px solid #ddd;
    border-radius: 6px;
  }

  /* 进入时激活 */
  .todo-enter-active {
    animation: atguigu 0.5s linear;
  }

  /* 离开时激活 */
  .todo-leave-active {
    animation: atguigu 0.5s linear reverse;
  }

  @keyframes atguigu {
    from {
      transform: translateX(-100%);
    }
    to {
      transform: translateX(0);
    }
  }
</style>